﻿using UnityEngine;
using System.Collections;

public class SetSkinColor : MonoBehaviour
{

		public Color myColor;
		public Texture2D paletteImage;
		public int paletteImageWidth;
		public int paletteImageHeight;

		// Use this for initialization
		void Start ()
		{
				//myColor = new Color (Random.value, Random.value, Random.Range (0.5f, 1.0f), 1.0f);
				paletteImageWidth = paletteImage.width;
				paletteImageHeight = paletteImage.height;
				myColor = paletteImage.GetPixel (Random.Range (0, paletteImageWidth - 1), Random.Range (0, paletteImageHeight - 1));
				//renderer.material.color = myColor;
				foreach (Transform child in transform)  
				{
					if (child.tag == "Skin")
					{
						child.renderer.sharedMaterial.color = myColor;
					}	
				}
		}
	
		// Update is called once per frame
		void Update ()
		{
	
		}
}
